﻿using DataAccess.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccess
{
    public class RedisOperation
    {
        #region 获取登录用户Session信息 UserSession

        public static bool SetUserSession(UserSession session)
        {
            string redisKey = RedisKey.UserSession(session.id);
            RedisHelper.Single_Remove_Itme(redisKey);
            return RedisHelper.Single_Set_Itme<UserSession>(redisKey, session);
        }

        public static UserSession GetUserSession(string sessionid)
        {
            string redisKey = RedisKey.UserSession(sessionid);
            return RedisHelper.Single_Get_Itme<UserSession>(redisKey);
        }

        #endregion
    }
}
